<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=1.0, minimum-scale=1.0, maximum-scale=1.0" />
	<title>个人详情</title>
	<link rel="stylesheet" type="text/css" href="common.css">
</head>
<body>
	<div class="conn">
		登录名
		<input type="text" id="login_name" value="张满">
	</div>
	<div class="conn">
		姓名
		<input type="text" id="real_name" value="张满">
	</div>
	<div class="conn">
		年龄
		<input type="text" id="age" value="25">
	</div>
	<div class="conn">
		部门
		<input type="text" id="department" value="学生会">
	</div>
	<div class="conn">
		手机号码
		<input type="text" id="phone" value="13584565214">
	</div>
	<div class="conn">
		修改密码
		<input type="password" id="password" value="13584565214">
	</div>
	<div class="conn">
		备注
		<input type="text" id="remarks" value="备注">
	</div>

	<div style="text-align: center;">
		<div style="width: 32%;height: 0.36rem;background-color: #04a3ff;text-align: center;line-height: 0.36rem;border-radius: 0.25rem;margin: 0.15rem auto;display: inline-block;" onclick="updatehandle()">
			保存信息
		</div>
		<a href="person.html">
		<div style="width: 32%;height: 0.36rem;background-color: #04a3ff;text-align: center;line-height: 0.36rem;border-radius: 0.25rem;margin: 0.15rem auto;display: inline-block;">
			返回
		</div>
		</a>
		<div style="width: 32%;height: 0.36rem;background-color: #04a3ff;text-align: center;line-height: 0.36rem;border-radius: 0.25rem;margin: 0.15rem auto;display: inline-block;" onclick="loginout()">
			退出登录
		</div>
	</div>
	<script src="js/jquery-1.8.3.min.js"></script>
	<script src="js/common.js"></script>
	<script type="text/javascript">
		$.ajax({
			type:"POST",
			url:"../Handle/getHandle",
			contentType : "application/json;charset=UTF-8",
			dataType:"Json",
			success:function(res){
				var info = res.info;
				var data = res.object;
				if(info=="success"){
					$("#login_name").val(data.login_name); 
					$("#real_name").val(data.real_name); 
					$("#age").val(data.age); 
					$("#department").val(data.deparentment); 
					$("#password").val(data.password); 
					$("#phone").val(data.phone); 
					$("#remarks").val(data.remarks); 
				}else if(info=="false"){
					window.location.href="login.html";
				}
			}
		});
		
		var updatehandle = function(){
			var login_name=$("#login_name").val(); 
			var real_name  = $("#real_name").val(); 
			var age = $("#age").val(); 
			var deparentment = $("#department").val(); 
			var password  = $("#password").val(); 
			var phone  = $("#phone").val(); 
			var remarks  = $("#remarks").val();
			console.log(login_name)
			console.log(real_name)
			console.log(age)
			console.log(department)
			console.log(password)
			console.log(phone)
			console.log(remarks)
			$.ajax({
				type:"POST",
				url:"../Handle/updateHandle",
				data:{login_name:login_name,real_name:real_name,age:age,deparentment:deparentment,password:password,phone:phone,remarks:remarks},
				dataType:"Json",
				success:function(res){
					console.log(res)
				}
			});
		}
		
		var loginout = function(){
			var num = 2;
			$.ajax({
				type:"POST",
				url:"../login/loginout",
				data:{num:num},
				contentType : "application/json;charset=UTF-8",
				dataType:"Json",
				success:function(res){
					window.location.href="login.html";
				}
			});
		}
	</script>
</body>
</html>